package cn.kgc.service.impl;

import cn.kgc.DevUser;
import cn.kgc.dao.devuser.DevUserMapper;
import cn.kgc.service.DevUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DevUserServiceImpl implements DevUserService {
    @Resource
    private DevUserMapper devUserMapper;
    @Override
    public DevUser login(String devCode, String devPassword) {
        try {
            //调用登录的方法
            DevUser devUser=devUserMapper.findByDevCode(devCode);
            //判断开发者是否存在
            if (devUser!=null) {
                //验证密码是否正确
                if (devUser.getDevPassword().equals(devPassword)) {
                    return devUser;
                }
            }
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
        return null;
    }
}
